package java_class_work.week06;

import java.util.HashMap;

/**
 * @Auther: admin
 * @Date: 2022/10/17 10:55
 * @Description:
 */

public class HashMapDemo01 {
    public static void main(String[] args) {
        HashMap<String, String> hs = new HashMap<>(4);
        hs.put("driverClass","com.mysql.cj.jdbc.Driver");
        hs.put("url","jdbc:mysql://localhost:3306/hbnu");
        hs.put("username","admin");
        hs.put("password","123456");

        System.out.println(hs);
        // 获取所有的键，
        System.out.println("遍历键：");
        hs.keySet().forEach(System.out::println);
        // 获取所有的值
        System.out.println("遍历值：");
        hs.values().forEach(System.out::println);
        // 遍历键值对
        System.out.println("遍历键值对:");
        hs.forEach((key,value) -> System.out.println(key+" = "+value));
    }
}
